<?php

class GuessStatisticsMessage {
    
    public function printGuessStatistics($candidate, $count)
    {
        $number = "";
        if ($count == 0) {
            $number = "no";
            $verb = "are";
            $pluraModifier = "s";

        } elseif ($count == 1) {
            $number = "1";
            $verb = "is";
            $pluraModifier = "";            
        } else {
            $number = (string)$count;
            $verb = "are";
            $pluraModifier = "s";
        }

        printf("There %s %s %s%s", $verb, $number, $candidate, $pluraModifier);
    }
    
    
    ################  clean code
    ################  clean code
    ################  clean code
    private $number;
    private $verb;
    private $pluraModifier;
    
    /**
     * 
     * @param string $candiate
     * @param int $count
     */
    public function make($candiate, $count)
    {
        $this->createPluraDependentMessageParts($count);
        printf("There %s %s %s%s", $this->verb, $this->number, $candiate, $this->pluraModifier);
    }
    

    /**
     * 
     * @param int $count
     */
    private function createPluraDependentMessageParts($count)
    {
        switch ($count) {
            case 0:
                $this->thereAreNoLetters();
                break;
            case 1:
                $this->thereIsOneLetter();
                break;
            default:
                $this->thereAreManyLetters($count);
                break;
        }
    }
    
    private function thereAreNoLetters()
    {
        $this->number = 'no';
        $this->verb = "are";
        $this->pluraModifier = "s";
        
    }
    
    private function thereIsOneLetter()
    {
        $this->number = 'one';
        $this->verb = "is";
        $this->pluraModifier = "";
    }
    
    private function thereAreManyLetters($count)
    {
        $this->number = $count;
        $this->verb = "are";
        $this->pluraModifier = "s";
        
    }
    
    
            


}